@use './search' as *;
@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap');


$primary-color: #2deb8a;
$secondary-color: #3c4553;
$light-gray: #e6e6e6;
$medium-gray: #cacaca;

$powder-blue: #d0d8e2;
$ice-blue: color-mix(in srgb, var(--sapBackgroundColor), var(--fg-color) 10%);
$border-color: #b6bac1;

$height-shellbar: 64px;
$height-shellbar-mobile: 64px;

$side-nav-width-desktop: 320px;
$side-nav-width-mobile: 260px;

$main-nav-item-height: 36px;


$fg-color: var(--fg-color);
$bg-color: var(--sapBackgroundColor);
$global-font-family: "Inter", ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
$luigi-green: #2deb8a;
$searchfield-bg: color-mix(in srgb, $bg-color, white 5%);
$searchfield-bg-active: color-mix(in srgb, $bg-color, white 10%);


:root {
  
  color-scheme: dark;
  --luigi__left-sidenav--width: 320px;
  --sapContent_IconColor: #2deb8a;
  --fdShellbar_SearchField_Input_Border_Radius: 3px;  
  --fdShellbar_Branding_Hover_Background: transparent;
  --icon-sun: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='4'/%3E%3Cpath d='M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M6.34 17.66l-1.41 1.41M19.07 4.93l-1.41 1.41'/%3E%3C/svg%3E");
  --icon-moon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z'/%3E%3C/svg%3E"); 
  
  // theme specific
  --bg-color: rgb(27, 27, 31);
  --fg-color: #dfdfd6;
  --header-border-color: black;
  
  --sapBackgroundColor: var(--bg-color);
  --sapTextColor: var(--fg-color);
  --fdButtonColor: var(--fg-color);
  --sapList_TextColor: var(--fg-color);
  --sapShell_TextColor:: var(--fg-color);
  --sapField_TextColor:: var(--fg-color);

  --sapList_Hover_Background: color-mix(in srgb, var(--sapBackgroundColor), black 30%);
  --sapList_Active_Background: gray;
  --sapList_BorderColor: var(--header-border-color);
  --sapGroup_ContentBorderColor: var(--header-border-color);
  
  --icon: var(--icon-moon);
  --theme-toggle-left: 9px;
}

body.lightTheme {  
  color-scheme: light;
  --bg-color: #f4f4f4;
  --fg-color: #3c3c43;
  --header-border-color: lightgray;
  --icon: var(--icon-sun);
  --theme-toggle-left: -9px;

  --sapBackgroundColor: var(--bg-color);
  --sapBackgroundColor: var(--bg-color);
  --sapTextColor: var(--fg-color);
  --fdButtonColor: var(--fg-color);
  --sapList_TextColor: var(--fg-color);
  --sapShell_TextColor:: var(--fg-color);
  --sapField_TextColor:: var(--fg-color);

  --sapList_Hover_Background: color-mix(in srgb, var(--sapBackgroundColor), black 30%);
  --sapList_Active_Background: gray;
  --sapList_BorderColor: var(--header-border-color);
  --sapGroup_ContentBorderColor: var(--header-border-color);
  --fdShellbar_Button_Outline_Color: var(--fg-color);
}

// Icon font
// @charset "UTF-8";


@mixin custom-icon {
  &:before {
    font-family: 'icon-font' !important;
    content: attr(data-icon);
    font-style: normal !important;
    font-weight: normal !important;
    font-variant: normal !important;
    text-transform: none !important;
    speak: none;
    line-height: 1;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }
}

@font-face {
  font-family: 'icon-font';
  src: url('/fonts/icon-font/icon-font.eot');
  src: url('/fonts/icon-font/icon-font.eot?#iefix') format('embedded-opentype'),
    url('/fonts/icon-font/icon-font.woff') format('woff'),
    url('/fonts/icon-font/icon-font.ttf') format('truetype'),
    url('/fonts/icon-font/icon-font.svg#icon-font') format('svg');
  font-weight: normal;
  font-style: normal;
}

[data-icon]:before {
  font-family: 'icon-font' !important;
  content: attr(data-icon);
  font-style: normal !important;
  font-weight: normal !important;
  font-variant: normal !important;
  text-transform: none !important;
  speak: none;
  line-height: 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

[class^='icon-']:before,
[class*=' icon-']:before {
  font-family: 'icon-font' !important;
  font-style: normal !important;
  font-weight: normal !important;
  font-variant: normal !important;
  text-transform: none !important;
  speak: none;
  line-height: 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.icon-github-icon:before {
  content: "\61";
}

.icon-slack-icon:before {
  content: "\63";
}

.icon-burger-menu:before {
  content: "\64";
}

.icon-burger-menu-close:before {
  content: "\65";
}


.fd-menu {
  @media screen and (max-width: 599px) {
    width: 100%;
  }
}

.luigi-documentation {
  * {
    font-family: $global-font-family;
  }

  .fd-shellbar {
    background-color: $bg-color;
    height: $height-shellbar-mobile;
    position: relative;
    z-index: 2;
    border-bottom: 1px solid var(--header-border-color);
    box-shadow: none;

    span {
      font-weight: 600;
    }


    .fd-shellbar__title {
      display: none;
    }

    .fd-popover:has(.luigi-search) {
      margin-top: 4px;
      max-height: $main-nav-item-height;
    }

    .fd-shellbar__search-field {
      margin: 0;
    }

    @media screen and (max-width: 1023px) {
      padding: 20px 30px;
    }

    @media screen and (min-width: 1024px) {
      height: $height-shellbar;
      padding: 0px 87px 0 60px !important;

      .fd-popover:has(.luigi-search) {
        margin-top: -2px;
      }
    }
  }

  .fd-shellbar-collapse {
    @media screen and (max-width: 1023px) {
      .fd-shellbar__button {
        padding-bottom: 0;
        margin-bottom: 0;
        height: auto;

        &.sap-icon--overflow {
          @include custom-icon;

          &:before {
            content: "\64";
            color: white;
            font-size: 20px;
          }

          &[aria-expanded='true'] {
            &:before {
              content: "\65";
            }
          }
        }
      }

      .fd-popover__body {
        position: fixed;
        top: $height-shellbar-mobile;
        left: 100%;
        right: 0;
        bottom: 0;
        box-shadow: none;
        border: none;
        border-radius: 0;
        transform: none;
        background-color: $bg-color;
        margin-top: -10px;
        padding: 10px 30px;
        overflow: auto;

        &[aria-hidden='false'] {
          left: 0;
        }

        &:before,
        &:after {
          display: none;
        }

        .fd-menu__item {
          padding: 15px 0;
          background-color: transparent;

          &:hover,
          &:active,
          &.is-selected,
          &[aria-selected=true] {
            color: $primary-color;
          }

          .fd-menu__link {
            background-color: transparent;
            border: 0;

            &.is-hover,
            &:hover {
              .fd-menu__title {
                color: $primary-color;
              }
            }

            &.is-selected,
            &[aria-selected=true] {
              .fd-menu__title {
                color: $primary-color;
                background-color: none;
              }
            }

            .fd-menu__title {
              color: $fg-color;
              font-weight: 600;
            }
          }
        }

        .fd-top-nav__icon,
        .y-full-width-list__icon {
          min-width: 34px;
          min-height: 24px;
        }

        li {
          border-bottom: 1px solid $border-color;
          border-radius: 0;
        }
      }
    }
  }

  .fd-button:focus {
    outline: none !important;
  }

  .fd-shellbar {
    .fd-search-input {

      a {
        text-decoration: none;
      }

      .fd-input[aria-hidden=true] {
        visibility: visible;
      }

      .fd-input {
        width: 100%;
        padding-left: 12px;
        padding-right: 30px;
        height: $main-nav-item-height;
        border-radius: 4px;
        font-size: 14px;
      }
    }


    .fd-button.fd-shellbar__button {
      border: none;
      border-radius: 0;
      background: none;
      max-height: none;
      min-width: 30px;
      color: $fg-color;

      span {
        &:not(.fd-top-nav__icon) {
          font-size: 14px;
          font-weight: 600;
          transition: all .2s ease;
          margin-left: 5px;
        }
      }

      i {
        line-height: 0;
        margin-top: -1.3rem;
      }

      .fd-top-nav__icon {
        line-height: 0;
        margin-top: -6px;
        margin-right: 0;

        &:before {
          margin-top: 0 !important;
          transform: translateX(-4px);
        }
      }

      &:hover,
      &.is-selected {
        span {
          &:not(.fd-top-nav__icon) {
            color: $luigi-green!important;
          }
        }
      }


      &:has(.sap-icon--search),
      &:has(.sap-icon--overflow) {
        height: $main-nav-item-height;
        margin: 6px 0 0 0;
        padding-bottom: 0;

        > i {
          line-height: 12px;
          margin: 0;
          color: var(--fg-color);
        }

        &:focus::after,
        &:focus::after {
          top: 2px;
        }
      }
    }

    @media screen and (min-width: 1024px) {
      .fd-button.fd-shellbar__button {

        span:not(.fd-top-nav__icon) {
          padding-bottom: 3px;
        }

        .fd-top-nav__icon {
          margin-top: -6px;
        }

        &:has(.sap-icon--search),
        &:has(.sap-icon--overflow) {
          margin: 0;
        }
      }
    }
  }

  .fd-app__sidebar,
  .iframeContainer {
    top: $height-shellbar-mobile;

    @media screen and (min-width: 1024px) {
      top: $height-shellbar;
    }
  }

  .iframeContainer,
  .spinnerContainer {
    left: $side-nav-width-desktop;
  }

  .fd-app__sidebar {
    box-shadow: none;
    background: var(--sapBackgroundColor);
  }

  .fd-shellbar__logo {
    max-height: 60px;

    img {
      max-height: 60px;
    }
  }

  .lui-customlogo {
    img {
      height: 32px !important;
      display: inline-block;
      vertical-align: middle;
      margin: 0 5px 0 0;
    }

    &::after {
      content: "Luigi";
      display: inline;
      color: $fg-color;
      vertical-align: middle;
      font-size: 18px;
      font-weight: 600;
      margin-left: 5px;
    }
  }

  .fd-page {
    background-color: $bg-color;
    overflow: hidden;
    line-height: initial;
  }

  .lui-side-nav__footer {
    background-color: $bg-color;
    color: var(--fg-color);
    min-height: 58px;

    a {
      color: var(--fg-color);
      display: inline-block;
      margin-right: 20px;
      text-decoration: none;

      &:last-child {
        margin-right: 0;
      }

      &:hover,
      &:active {
        color: $primary-color;
      }
    }

    .lui-side-nav__footer--text {
      width: 100%;
      color: var(--fg-color);
      font-size: 14px;
      font-weight: 600;
      padding: 20px 40px;
    }
  }

  .fd-top-nav__icon {
    font-size: 20px;
    line-height: 1;
    transition: color .3s ease;
    color: color-mix(in srgb, var(--fg-color), #fff 30%)!important;

    &:not(.sap-icon--search):before {
      font-family: 'icon-font' !important;
      content: attr(data-icon);
      font-style: normal !important;
      font-weight: normal !important;
      font-variant: normal !important;
      text-transform: none !important;
      speak: none;
      line-height: 1;
      -webkit-font-smoothing: antialiased;
      -moz-osx-font-smoothing: grayscale;
      font-size: 20px;
    }

    &:hover {
      color: $primary-color!important;
    }
  }

  .sap-icon--slack::before {
    content: "\63" !important;
  }

  .sap-icon--github::before {
    content: "\61" !important;
  }

  .fd-nested-list {
    border-bottom: none;

    &.level-2 {
      .fd-nested-list__item {
        padding-left: 5px;
      }
    }
  }

  .fd-nested-list__item {
    padding: 7px 0;

    &:last-child {
      border-bottom: none;
    }
  }

  .fd-nested-list__group-header,
  .fd-nested-list__item {
    background: none;
  }

  .fd-nested-list__link {
    font-size: 15px;
    height: auto;
    padding: 1px 7px;
    border-left: 2px solid transparent;
    border-bottom: none;
    border-top: none;

    &:hover,
    &.is-selected {
      border-color: $primary-color;
      color: $secondary-color;
      border-bottom: none !important;
      background: none;
      font-weight: 400;

      &:before {
        display: none;
      }
    }

    &:active {
      background-color: transparent;

      .fd-nested-list__title {
        color: var(--sapList_TextColor, #32363a);
      }
    }

    .fd-nested-list__title {
      font-size: 15px;
      white-space: normal;
      text-overflow: unset;
      width: auto;
      border: none;
    }

    .sap-icon--action {
      padding-left: 5px;
    }

    .fd-nested-list__icon {
      display: none;
    }

  }

  //disable the dotted line on deep-click
  .fd-side-nav .fd-nested-list__link {
    &:focus {
      outline: none;
    }
  }

  .has-child {
    text-transform: uppercase;
    border: none;
    font-size: 15px;
    padding: 8px 0;
    line-height: 1.42857;
    font-weight: 400;
    color: #6a6d70;
  }

  .fd-nested-list__button {
    background: none;
  }

  .fd-side-nav {
    background-color: transparent;
    border-right: none;

    .lui-fd-side-nav-wrapper {
      padding: 30px;

      @media screen and (min-width: 1024px) {
        padding: 20px 30px 20px;
      }
    }
  }

  .fd-side-nav__group {
    margin-bottom: 10px;
  }

  @media screen and (max-width: 599px) {
    .lui-burger {
      width: 50px;
      height: 50px;
      text-align: center;
      position: fixed;
      bottom: 0px;
      left: 20px;
      color: black;
      z-index: 20;
      transition: left 0.1s linear;
      background-color: white !important;
      padding: 15px;
      border-radius: 5px 5px 0 0 !important;
      box-shadow: rgba(137, 165, 199, 0.42) 0px 1px 26px 0px;
      cursor: pointer;
      margin: 0;

      &:before {
        display: none;
      }
      i {
        color: $secondary-color !important;
        margin: 0 !important;
      }
      &:hover i {
        color: $primary-color !important;
      }
    }

    &.lui-leftNavToggle {
      .lui-burger {
        left: calc(#{$side-nav-width-mobile} + 10px);

        &:before {
          transform: rotateZ(-180deg);
          display: block;
        }
      }
    }

    .fd-app__sidebar,
    .fd-side-nav {
      width: $side-nav-width-mobile;
    }

    &.lui-simpleSlideInNav.lui-leftNavToggle {
      .fd-app__sidebar,
      .fd-side-nav {
        width: $side-nav-width-mobile;
      }
    }

    &.lui-simpleSlideInNav.lui-leftNavToggle {
      .fd-app__sidebar,
      .fd-side-nav,
      .lui-side-nav__footer {
        display: flex;
      }
    }

    .lui-side-nav__footer {
      display: none;
    }

    .algolia-autocomplete .ds-dropdown-menu {
      box-shadow: none !important;
    }
  }

  @media screen and (max-width: 1023px) {
    .fd-search-input__control .fd-shellbar__button {
      padding-bottom: 0;
      margin-bottom: 0;
      height: auto;
    }
  }

  
  .fd-shellbar .fd-shellbar__search-field .fd-shellbar__search-field-input.luigi-search__input {
    background-color: $searchfield-bg;

    border: 1px solid $fg-color;

    &:hover {
      background-color: $searchfield-bg-active;
    }

    &:active {
      background-color: $searchfield-bg-active;
    }
  }

  .algolia-autocomplete {
    .ds-dropdown-menu {
      [class^=ds-dataset-], &:before {
        background: $bg-color;
      }
    }
    .algolia-docsearch-suggestion {
      background: $bg-color;
      & * {
        color: $fg-color;
      }
    }
  }
  
  .fd-shellbar__action:has(a[data-testid=none_themeswitch]) {
    position: relative;
    
    margin-left: 20px;
    margin-right: 22px;

    &::before {
      width: 1px;
      height: 24px;
      background-color: var(--header-border-color);
      content: "";
      position: absolute;
      top: 0;
      left: -14px;
    }
    &::after {
      width: 1px;
      height: 24px;
      background-color: var(--header-border-color);
      content: "";
      position: absolute;
      display: block;
      top: 0;
      right: -11px;
    }
  }

  .fd-shellbar .fd-button.fd-shellbar__button[data-testid=none_themeswitch] {
    width: 50px;
    margin-right: 5px;

    border-radius: 11px;
    width: 40px;
    height: 22px;
    -webkit-flex-shrink: 0;
    -ms-flex-negative: 0;
    flex-shrink: 0;
    border: 1px solid var(--fg-color);
    background-color: var(--bg-color);
    -webkit-transition: border-color .25s !important;
    transition: border-color .25s !important;
    pointer-events: auto;
    cursor: pointer;

    &::after {
      inset: -7px;
    }

    .sap-icon {
      background: color-mix(in srgb, var(--fg-color), #fff 30%);
      position: relative;
      display: block;
      top: 3px;
      left: var(--theme-toggle-left);
      width: 18px;
      height: 18px;
      border-radius: 50%;
      overflow: hidden;

      &::after {
        content: '';
        mask: var(--icon) no-repeat;
        position: absolute;
        top: 3px;
        left: 3px;
        width: 12px;
        height: 12px;
        color: var(--fg-color);
        background-color: var(--bg-color);
      }
    }
  }
}

